<template>
  <swiper>
    <swiper-item v-for="(item,index) in hbanners" :key="index">
      <a :href="item.link">
        <img :src="item.image" :alt="item.title" @load="imageLoad">
      </a>
    </swiper-item>
  </swiper>
</template>
<script>
import {Swiper,SwiperItem} from 'components/common/swiper'
export default {
  name:'HomeSwiper',
  props:{
    hbanners:{
      type:Array,
      default(){
        return []
      }
    }
  },
  data() {
    return {
      isLoad:false
    }
  },
  components:{
    Swiper,
    SwiperItem
  },
  methods: {
    imageLoad(){
      if(!this.isLoad){//有多少张轮播的图片就发射了多少次，我们只需发射一次
        this.$emit('swiperImageLoad')
        this.isLoad = true
      }
    }
  },
}
</script>
<style scoped>

</style>